import React, {Component} from 'react';
import { Icon, Button, Input, Select, Form, message, Row, Col, DatePicker } from 'antd';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import '@/common/css/index.less'

const FormItem = Form.Item;
const { TextArea } = Input;

const mapStateToProps = state => ({
    data: state.suggest.data
})


class ViewSuggestForm extends Component {
    constructor(props){
        super(props);

    }

    componentDidMount = () => {
        // console.log(this.props.suggestState)
    }

    render(){
        const formItemLayout = {
            labelCol: {lg: { span: 6 },xs: { span: 18 },sm: { span: 8 },},
            wrapperCol: {lg: { span: 18 },xs: { span: 24 },sm: { span: 12 },},
        };

        const { data } = this.props;

        return (
            <Form>
                <Row>
                    <Col span={10}>
                        <FormItem {...formItemLayout} label="建议标题" >
                            <Input value={data.subject} readOnly/>
                        </FormItem>
                    </Col>
                </Row>
                <Row>
                    <Col span={20}>
                        <Col span={12}>
                            <FormItem {...formItemLayout}  label="建议日期">
                                <Input value={data.created_at} readOnly/>
                            </FormItem>
                            <FormItem {...formItemLayout} label="建议人" >
                                <Input value={data.proposalPersonName} readOnly/>
                            </FormItem>
                        </Col>
                        <Col span={12}>
                            <FormItem {...formItemLayout} label="所属部门" >
                                <Input value={data.proposalPersonDeptName} readOnly/>
                            </FormItem>
                            <FormItem {...formItemLayout} label="联系电话" >
                                <Input value={data.contactPhone} readOnly/>
                            </FormItem>
                        </Col>       
                    </Col>
                </Row>
                <Row>
                    <Col span={10}>
                        <FormItem {...formItemLayout} label="建议内容" >
                            <TextArea autosize={{ minRows: 8, maxRows: 12 }} value={data.content}/>
                        </FormItem>
                        <FormItem {...formItemLayout} label="附件" >
                            
                        </FormItem>
                    </Col>
                </Row>
            </Form>
        )
    }
}

ViewSuggestForm.PropTypes = {
    data: PropTypes.object.isRequired
}

export default connect(mapStateToProps)(ViewSuggestForm);